{extend name="layout/layout" /}

{block name="pagecss"}
<style>

</style>
{/block}

{block name="content"}
<div class="row">
    <div class="col-md-12">
        <div class="portlet light">
            <div class="portlet-title">
                <div class="caption">
                    <i class="icon-share font-dark"></i>
                    <span class="caption-subject font-dark bold uppercase"> 新增村民</span>
                </div>
                <div class="actions">
                    <a class="btn btn-circle btn-icon-only btn-default fullscreen" href="javascript:;" data-original-title="" title=""> </a>
                </div>
            </div>
            <div class="portlet-body">
                <form id="ajax-form" class="form-horizontal" enctype="multipart/form-data">
                    {:token()}
                    <div class="form-body">
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        类型
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <div class="mt-radio-inline member-type">
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="" name="memberType" value="1" checked="">
                                                本地居民
                                                <span></span>
                                            </label>
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="" name="memberType" value="2">
                                                外来人口
                                                <span></span>
                                            </label>
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="" name="memberType" value="3">
                                                流动人口
                                                <span></span>
                                            </label>
                                        </div>
                                        <div class="form-inline belong-location">
                                            <div class="col-md-12" style="padding-left: 0;">
                                                {include file="common:selectarea" /}
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        头像
                                    </label>
                                    <div class="col-md-9">
                                        <div id="upload-image">
                                            <span id="upload-btn" data-multi="false">
                                                <input type="hidden" class="form-control" id="avatar"  name="avatar" value="">
                                                <img src="__STATIC__/admin/img/default.png" alt="图片上传" style="width: 100px;height: 100px;" />
                                            </span>
                                        </div>
                                        <span class="help-block"> (建议尺寸：110*110) </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        姓名
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <input type="text" class="form-control" name="name" value="" maxlength="20">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        性别
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <div class="mt-radio-inline">
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="" name="gender" value="1" placeholder="" checked="">
                                                男
                                                <span></span>
                                            </label>
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="" name="gender" value="2" placeholder="">
                                                女
                                                <span></span>
                                            </label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        身份证号
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <input type="text" class="form-control" maxlength="18" id="identityNumber" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^0-9Xx]/g,'')}else{this.value=this.value.replace(/[^0-9Xx]/g,'')}"  name="identityNumber" data-identityNumber="" value="" >
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        手机号
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <input type="text" class="form-control" maxlength="13" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^0-9]/g,'')}else{this.value=this.value.replace(/[^0-9-]/g,'')}" id="mobile"  name="mobile" value="" >
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        详细住址
                                    </label>
                                    <div class="col-md-9">
                                        <input type="text" maxlength="40" placeholder="最多输入40字符" class="form-control" id="address"  name="address" value="">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        是否是户主
                                    </label>
                                    <div class="col-md-2">
                                        <div class="mt-radio-inline switch-isHouseholder">
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="" name="isHouseholder" value="1" placeholder="" checked="">
                                                是
                                                <span></span>
                                            </label>
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="" name="isHouseholder" value="2" placeholder="">
                                                否
                                                <span></span>
                                            </label>
                                        </div>
                                    </div>
                                    <div class="related-householder">
                                        <div class="col-md-4">
                                            <!--<select class="form-control select2-data-ajax" name="householderId">
                                                <option value="0" selected="selected">请输入户主名</option>
                                            </select>-->
                                            <button class="form-control select-householder" type="button" data-title="选择户主">选择户主</button>
                                            <input type="hidden" name="householderId" value="">
                                        </div>
                                        <div class="col-md-3">
                                            <select class="form-control" name="relatedHouseholder">
                                                <option value="0">与户主关系</option>
                                                {foreach name="relatedHouseholderList" item="relatedHouseholders" key="relatedHouseholderkey"}
                                                <option value="{$relatedHouseholderkey}">{$relatedHouseholders}</option>
                                                {/foreach}
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        是否为党员
                                    </label>
                                    <div class="col-md-9 isparty">
                                        <div class="mt-radio-inline">
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="" name="isParty" value="1" >
                                                是
                                                <span></span>
                                            </label>
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="" name="isParty" value="2" checked>
                                                否
                                                <span></span>
                                            </label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        民族
                                    </label>
                                    <div class="col-md-9">
                                        <select class="form-control" name="ethnicId">
                                            {foreach $ethnicList as $ethnics}
                                            <option value="{$ethnics.id}">{$ethnics.name}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        文化程度
                                    </label>
                                    <div class="col-md-9">
                                        <select class="form-control" name="education">
                                            <option value="0">请选择</option>
                                            {foreach name="educationList" item="educations" key="educationkey"}
                                            <option value="{$educationkey}">{$educations}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        村民排序
                                        <!--<span class="required">*</span>-->
                                    </label>
                                    <div class="col-md-9">
                                        <input type="number" class="form-control" id="sorting" name="sorting" value="1" >
                                    </div>
                                </div>
                            </div>
                        </div>

                        <input type="hidden" name="id" value="">
                        <hr />

                        <div class="row">
                            <div class="form-actions">
                                <div class="col-md-offset-2 col-md-10">
                                    <button type="button" class="btn blue save-btn">
                                        保存 <i class="fa fa-floppy-o"></i>
                                    </button>
                                    <button type="button" class="btn default" onclick="history.go(-1);">
                                        返回 <i class="fa fa-mail-forward"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<input type="hidden" class="token_url" value="{:url('admin/Image/token')}">
<input type="hidden" class="record_url" value="{:url('admin/Image/record')}">
<input type="hidden" class="delimage_url" value="{:url('admin/Image/delete')}">
<input type="hidden" class="save_url" value="{:url('admin/member/addPost')}">
<input type="hidden" class="checkNum_url" value="{:url('admin/member/checkIdentityNumber')}">

<input type="hidden" class="ajax_member_url" value="{:url('admin/layer/ajaxMembers')}">
<input type="hidden" class="householder_member_url" value="{:url('admin/layer/householderList')}">
{/block}

{block name="pagescript"}
<script src="__STATIC__/admin/js/qiniu/plupload.full.min.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniu.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/custom.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniuConfig.js" type="text/javascript"></script>

<script src="__STATIC__/admin/pages/js/uploadfile.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/member.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/select_member.js" type="text/javascript"></script>
{/block}